package services;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import repositories.ActorRepository;
import security.LoginService;
import security.UserAccount;
import domain.Actor;

@Service
@Transactional
public class ActorService {

	// Managed repository -----------------------------------------------------
	
		@Autowired
		private ActorRepository actorRepository;

		// Constructors -----------------------------------------------------------

		public ActorService() {
			super();
		}

		// Other business methods -------------------------------------------------

		public Actor findByPrincipal() {
			UserAccount u = LoginService.getPrincipal();
			Actor a = actorRepository.findByUserAccountId(u.getId());
			return a;
		}
}
